package com.xhu.servlet;

import com.xhu.bean.pojo.Analyse;
import com.xhu.service.AnalyseService;
import com.xhu.service.impl.AnalyseServiceImpl;
import com.xhu.utils.BaseServlet;
import com.xhu.utils.FormatUtils;
import com.xhu.utils.ResultData;
import org.apache.commons.beanutils.BeanUtils;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@WebServlet("/analyseServlet/*")
public class AnalyseServlet extends BaseServlet {
    public  ResultData  list(HttpServletRequest  request){
        //会接收到前端三个参数
        //page  limit    name
        Integer   page=FormatUtils.stringFormatInteger(request.getParameter("page"));
        Integer   limit=FormatUtils.stringFormatInteger(request.getParameter("limit"));
        String  name=FormatUtils.formatString(request.getParameter("name"));
        AnalyseService analyseService=new AnalyseServiceImpl();
        List<Analyse> list=analyseService.queryPage(page,limit,name);
        return  ResultData.ok().data(list);
    }

    public  ResultData  findAll(HttpServletRequest  request){
        AnalyseService analyseService=new AnalyseServiceImpl();
        List<Analyse> list=analyseService.findAll();
        return  ResultData.ok().data(list);
    }

}